#include <Arduino.h>
#include <WiFi.h>

const char *ssid = "461"; // Wifi名称
const char *password = "20030717";		  // Wifi密码

const IPAddress serverIP(192, 168, 31, 21); // 欲访问的服务端IP地址
uint16_t serverPort = 19810;				  // 服务端口号

WiFiClient client; // 声明一个ESP32客户端对象，用于与服务器进行连接

void WiFi_Connect()
{
	WiFi.begin(ssid, password);
	while (WiFi.status() != WL_CONNECTED)
	{
		delay(300);
		// Serial.print(".");
	}
}

void Wifi_init()
{
	WiFi.mode(WIFI_STA);
	WiFi.setSleep(false);

	Serial.print("Connecting.. ");

	WiFi_Connect();

	Serial.println("WiFi connected");

	Serial.println("IP address: ");
	Serial.println(WiFi.localIP());
}